package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserProtectionQueryRequest extends Request {
	
	private int id;
	
	public int getUid() {
		return id;
	}

	public void setUid(int id) {
		this.id = id;
	}

	/**
	 * 解析说明：用户账号保护信息与用户账号绑定，id应为用户id，此时，传进来如果缺少用户id，系统无法进行绑定，此记录没意义，所以保存此记录的前提是用户id是存在的
	 */
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		
		if(id == 0) {
			throw new RequestIllegalException("传递错误的参数，请确认用户是否存在!");
		}
	}

}
